﻿using Dolany.UtilityTool;
using Missbot.Model.MsgInfos;

namespace Missbot.Core.Base
{
    /// <summary>
    /// 收消息会话
    /// </summary>
    public class InboxSession
    {
        public string SourceID { get; init; }
        
        public InstanceUser User { get; init; }
 
        public string Text { get; set; }

        public InstanceFile[] Files { get; init; }

        public InstanceGroup Group { get; init; }
        
        public IMsgChannel Channel { get; set; }
        
        public string[] Tags { get; init; }
        
        public SafeDictionary<string, object> Addition { get; init; } = SafeDictionary<string, object>.Empty;

        public void SendBack(string text, string file = null)
        {
            Channel.Send(this, text, file);
        }

        public void SendGroup(InstanceUser aimUser, string text, string file = null)
        {
            Channel.SendGroup(new []{User, aimUser}, Group, SourceID, text, file);
        }
    }
}